<!-- <script setup>
import {ref,onMounted} from 'vue';
import http from '@/utils/http';
import { useRoute } from 'vue-router';

const route = useRoute();
let id= route.params.id;
const user = ref(null); 

const getUser = async () => {
    const response = await http.get('/person/getUserById',{
        params:{id: id}
    },)
    user.value = response.data;
}

onMounted(() => {
    console.log('请求用户信息');
    getUser();
})
</script>

<template>
<div>
    <h1>个人中心</h1>
    <div v-if="user">
        <p>{{ user.name }}</p>
        <p>{{ user.gender }}</p>
    </div>
</div>
</template>

<style scoped>
</style> -->

<script setup>
import {ref,onMounted} from 'vue';
import http from '@/utils/http.js'
const list = ref([]);

const getUserList = async () => {
    const response = await http.get('/person/list');
    list.value = response.data;
}

onMounted(() => {
    console.log('请求用户信息');
    getUserList();
})
</script>

<template>
<div>
    <h1>个人中心</h1>
    <el-row v-if="list.length>0">
        <el-col :span="4">
            <el-card v-for="user in list.slice(0,1)" :key="user.id">
                <p>{{ user.name }}</p>
                <p>{{ user.gender }}</p>
            </el-card>
        </el-col>
    </el-row>
</div>
</template>

<style scoped>
</style>
